Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@google-cloud/precise-date

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/precise-date

A simple utility for precise-dateing functions and classes.

  • 3.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @google-cloud/precise-date?

The @google-cloud/precise-date npm package provides a way to handle high-precision dates and times in JavaScript, particularly useful when dealing with databases like Google Cloud Spanner that require precise time specifications down to the nanosecond.

What are @google-cloud/precise-date's main functionalities?

Creating precise dates

This feature allows the creation of date objects that include nanosecond precision. It is particularly useful for applications that need to maintain high accuracy in time stamps, such as logging events in a distributed system or transactions in financial services.

const {PreciseDate} = require('@google-cloud/precise-date');
const preciseDate = new PreciseDate('2019-01-01T12:00:00.000000123Z');
console.log(preciseDate.toISOString());

Comparing precise dates

This feature allows for the comparison of two PreciseDate objects, returning -1, 0, or 1 depending on whether the first date is earlier, the same as, or later than the second date. This is useful for sorting or managing time-based data accurately.

const {PreciseDate} = require('@google-cloud/precise-date');
const date1 = new PreciseDate('2020-05-18T12:00:00.000000123Z');
const date2 = new PreciseDate('2020-05-18T12:00:00.000000124Z');
console.log(date1.compare(date2));

Other packages similar to @google-cloud/precise-date

Keywords

FAQs

Package last updated on 26 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc